/* ==========================================================================
   动画和微交互效果
   ========================================================================== */

/* 基础动画变量 */
:root {
    --animation-duration-fast: 0.15s;
    --animation-duration-normal: 0.3s;
    --animation-duration-slow: 0.5s;
    --animation-ease: cubic-bezier(0.4, 0, 0.2, 1);
    --animation-ease-in: cubic-bezier(0.4, 0, 1, 1);
    --animation-ease-out: cubic-bezier(0, 0, 0.2, 1);
    --animation-ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --animation-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* 页面加载动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0, 0, 0);
    }
    40%, 43% {
        transform: translate3d(0, -8px, 0);
    }
    70% {
        transform: translate3d(0, -4px, 0);
    }
    90% {
        transform: translate3d(0, -2px, 0);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-4px);
    }
    75% {
        transform: translateX(4px);
    }
}

@keyframes glow {
    0% {
        box-shadow: 0 0 5px rgba(99, 102, 241, 0.2);
    }
    50% {
        box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
    }
    100% {
        box-shadow: 0 0 5px rgba(99, 102, 241, 0.2);
    }
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-6px);
    }
    100% {
        transform: translateY(0px);
    }
}

/* 页面元素进入动画 */
.animate-fade-in {
    animation: fadeIn var(--animation-duration-slow) var(--animation-ease-out);
}

.animate-slide-in-up {
    animation: slideInUp var(--animation-duration-normal) var(--animation-ease-out);
}

.animate-slide-in-down {
    animation: slideInDown var(--animation-duration-normal) var(--animation-ease-out);
}

.animate-slide-in-left {
    animation: slideInLeft var(--animation-duration-normal) var(--animation-ease-out);
}

.animate-slide-in-right {
    animation: slideInRight var(--animation-duration-normal) var(--animation-ease-out);
}

.animate-scale-in {
    animation: scaleIn var(--animation-duration-normal) var(--animation-ease-out);
}

/* 悬停动画效果 */
.hover-lift {
    transition: transform var(--animation-duration-normal) var(--animation-ease);
}

.hover-lift:hover {
    transform: translateY(-4px);
}

.hover-scale {
    transition: transform var(--animation-duration-normal) var(--animation-ease);
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-glow {
    transition: box-shadow var(--animation-duration-normal) var(--animation-ease);
}

.hover-glow:hover {
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.15);
}

.hover-bounce {
    transition: transform var(--animation-duration-fast) var(--animation-bounce);
}

.hover-bounce:hover {
    animation: bounce 0.6s;
}

/* 加载动画 */
.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-dots {
    display: inline-flex;
    gap: 4px;
}

.loading-dots span {
    width: 6px;
    height: 6px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: loading-dots 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes loading-dots {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 进度条动画 */
.progress-bar {
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    transform: translateX(-100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* 视频卡片动画 */
.videoo {
    animation: slideInUp var(--animation-duration-slow) var(--animation-ease-out);
    transition: all var(--animation-duration-normal) var(--animation-ease);
}

.videoo:nth-child(1) { animation-delay: 0.1s; }
.videoo:nth-child(2) { animation-delay: 0.2s; }
.videoo:nth-child(3) { animation-delay: 0.3s; }
.videoo:nth-child(4) { animation-delay: 0.4s; }
.videoo:nth-child(5) { animation-delay: 0.5s; }
.videoo:nth-child(6) { animation-delay: 0.6s; }

/* 按钮动画 */
.btn, button {
    position: relative;
    overflow: hidden;
    transition: all var(--animation-duration-normal) var(--animation-ease);
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

/* 模态框动画 */
.modal.fade .modal-dialog {
    transition: transform var(--animation-duration-normal) var(--animation-ease);
    transform: scale(0.8);
}

.modal.show .modal-dialog {
    transform: scale(1);
}

/* 搜索框动画 */
.search_form input {
    transition: all var(--animation-duration-normal) var(--animation-ease);
}

.search_form input:focus {
    transform: scale(1.02);
}

/* 侧边栏动画 */
.side_menu {
    transform: translateX(-100%);
    transition: transform var(--animation-duration-normal) var(--animation-ease);
}

.side_menu.active {
    transform: translateX(0);
}

.mm_menu li {
    opacity: 0;
    transform: translateX(-20px);
    transition: all var(--animation-duration-normal) var(--animation-ease);
}

.side_menu.active .mm_menu li {
    opacity: 1;
    transform: translateX(0);
}

.side_menu.active .mm_menu li:nth-child(1) { transition-delay: 0.1s; }
.side_menu.active .mm_menu li:nth-child(2) { transition-delay: 0.15s; }
.side_menu.active .mm_menu li:nth-child(3) { transition-delay: 0.2s; }
.side_menu.active .mm_menu li:nth-child(4) { transition-delay: 0.25s; }
.side_menu.active .mm_menu li:nth-child(5) { transition-delay: 0.3s; }

/* 导航栏动画 */
header {
    animation: slideInDown var(--animation-duration-slow) var(--animation-ease-out);
}

/* Banner动画 */
.banner-section {
    animation: fadeIn var(--animation-duration-slow) var(--animation-ease-out);
}

.banner-text h2 {
    animation: slideInUp var(--animation-duration-slow) var(--animation-ease-out) 0.2s both;
}

.banner-text .btn {
    animation: slideInUp var(--animation-duration-slow) var(--animation-ease-out) 0.4s both;
}

/* 表单动画 */
.form-group {
    animation: slideInUp var(--animation-duration-normal) var(--animation-ease-out);
}

.form-group:nth-child(1) { animation-delay: 0.1s; }
.form-group:nth-child(2) { animation-delay: 0.2s; }
.form-group:nth-child(3) { animation-delay: 0.3s; }
.form-group:nth-child(4) { animation-delay: 0.4s; }

/* 评论动画 */
.cmn-lst li {
    animation: slideInLeft var(--animation-duration-normal) var(--animation-ease-out);
}

.cmn-lst li:nth-child(1) { animation-delay: 0.1s; }
.cmn-lst li:nth-child(2) { animation-delay: 0.2s; }
.cmn-lst li:nth-child(3) { animation-delay: 0.3s; }

/* 错误和成功消息动画 */
.success-message,
.error-message,
.upload-success,
.upload-error {
    animation: slideInDown var(--animation-duration-normal) var(--animation-ease-out);
}

/* 图标动画 */
.icon-hover {
    transition: transform var(--animation-duration-fast) var(--animation-ease);
}

.icon-hover:hover {
    transform: rotate(360deg);
}

/* 视频时间标签动画 */
.vid-time {
    opacity: 0;
    transform: translateY(20px);
    transition: all var(--animation-duration-normal) var(--animation-ease);
}

.videoo:hover .vid-time {
    opacity: 1;
    transform: translateY(0);
}

/* 播放按钮动画 */
.play_vid {
    transform: scale(0.8);
    opacity: 0;
    transition: all var(--animation-duration-normal) var(--animation-ease);
}

.videoo:hover .play_vid {
    transform: scale(1);
    opacity: 1;
    animation: pulse 2s infinite;
}

/* 页面切换动画 */
.page-transition {
    animation: fadeIn var(--animation-duration-slow) var(--animation-ease-out);
}

/* 滚动触发动画 */
.scroll-animate {
    opacity: 0;
    transform: translateY(50px);
    transition: all var(--animation-duration-slow) var(--animation-ease-out);
}

.scroll-animate.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* 特殊效果 */
.gradient-text {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-shift 3s ease-in-out infinite;
}

@keyframes gradient-shift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

/* 响应式动画优化 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (max-width: 768px) {
    .videoo {
        animation-delay: 0s;
    }
    
    .mm_menu li {
        transition-delay: 0s;
    }
    
    .form-group {
        animation-delay: 0s;
    }
} 